Ext.ns("ProjectCheckView");
ProjectCheckView = Ext.extend(Ext.Panel, {
    constructor : function(a) {
        Ext.applyIf(this, a);
        var all=this.initUIComponents();
        ProjectCheckView.superclass.constructor.call(this, {
            id : "ProjectCheckView",
            title : "项目检查管理",
            region : "center",
            layout : "border",
            border : false,
            iconCls : "menu-position",
            items : [all.yearGridPanel,all.yearGridSearchPanel,all.yearGridTreePanel]
        });
    },
    initUIComponents : function() {
         var yearGridComponents=new createyeargridview({
            topbar : {
                inputFormName : 'ProjectCheckForm',
                topbarAdd:{
                    hidden:false
                },
                topbarDel:{
                    hidden:false
                }
            },
            search : {
                items : [ {
                    style : "margin:5px 5px 5px 5px;",
                    text : "项目名称"
                }, {
                    columnWidth : 0.2,
                    xtype : "textfield",
                    name : "Q_projectName_S_LK",
                    maxLength : 256
                } ]
            },
            grid : {
                title : "项目检查列表",
                rowActions:true,
                listUrl : __ctxPath + "/constructionproject/listProjectCheck.do",
                removeUrl : __ctxPath + "/constructionproject/deleteProjectCheck.do",
                fields : [ "id", 'years','institution',"projectCheckId","projectName","constructionUnit",'safeDutyPerson', "checkOrganization", "checkDutyPerson", "attendCheckPersons","checkContent","checkConclusion"],
                columns : [ {
                    header : "id",
                    dataIndex : "id",
                    hidden : true
                }, {
                    header : "年份",
                    dataIndex : "years",
                    width : 50,
                    hidden:true,
                    sortable : true
                }, {
                    header:"项目名称",
                    dataIndex:'projectName',
                    width:100
                },{
                    header : "施工方",
                    dataIndex : "constructionUnit",
                    width : 100
                }, {
                    header : "安全责任人",
                    dataIndex : "safeDutyPerson",
                    width : 70
                }, {
                    header : "检查机构",
                    dataIndex : "checkOrganization",
                    width : 70
                },
                 {
                    header : "检查负责人",
                    dataIndex : "checkDutyPerson",
                    width : 70
                },
                {
                    header : "参检人员",
                    dataIndex : "attendCheckPersons",
                    width : 70
                }
                , new Ext.grid.Column({
                    header : "存在问题",
                    dataIndex : "scIdps",
                    sortable : false,
                    scope:this,
                    width :70,
                    renderer : function(j, i, g, m, h) {
                        var cfg={
                                projectCheckId : g.data.id,
                                years : g.data.years
                        }
                        var k = "";
                        k += '<button title="整改" value="" class="btn-showDetail" onclick=\'ProjectCheckView.hiddenRecored('
                            + g.data.id + ')\'></button>';
                              
                                return k;      
                    }
                })
                
                ]
            },
            tree : {
                treeUrl : __ctxPath + "/constructionproject/treeLoadProjectCheck.do"
            }
            
        });
        return yearGridComponents;
    }
});

ProjectCheckView.hiddenRecored = function(id){
    new HiddenDangerOfProjectWindow({
    	projectCheckId : id,
    }).show();
};

